home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
ums
/
ums-beta
/
rexx
/
writemessage.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1995-05-13
|
2KB
|
111 lines
/* ------------------------------------------------------------------------
:Program. WriteMessage.rexx
:Contents. writes a new message to UMS' messagebase
:Author. Kai Bolay [kai]
:Address. Snail Mail: EMail:
:Address. Hoffmannstraße 168 UUCP: kai@amokle.stgt.sub.org
:Address. D-71229 Leonberg FIDO: 2:2407/106.3
:History. v1.0 [kai] 23-Sep-93
:History. v1.1 [hG] 16-Jan-94 added argument passing
:History. v1.2 [hG] 23-Jan-94 uses UMSInit.rexx 1.1 and
:History. hgRexxSupport.library
:History. v2.0 [kai] 21-Dec-94 adapted to UMS v11
:History. v2.1 [kai] 13-May-95 added support for FILE
:Version. $VER: WriteMessage.rexx 2.1 (13.5.95)
:Copyright. Public Domain
:Language. ARexx
:Translator. RexxMast
------------------------------------------------------------------------ */
options results
RC = 0
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on ERROR
signal on HALT
signal on IOERR
signal on SYNTAX
/*** Init ***/
call addlib("rexxdossupport.library", 0, -30)
call addlib("ums.library", 0, -210, 11)
call UMSInitConsts()
/*** Arguments ***/
ProgramName = "WriteMessage";
ArgsTemplate = "NAME/A,PASSWORD,SERVER/K,FILE/A";
args.SERVER = ""
args.PASSWORD = ""
parse arg arguments
if strip(arguments) = '?' then do
call writech(STDOUT, ArgsTemplate || ': ')
arguments = readln(STDIN)
end; else nop
if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
say Fault(RC, ProgramName)
exit 10
end; else nop
/*** Login ***/
account = UMSLogin(args.name, args.password, args.server)
if account = 0 then do
say "unable to login."
exit 10
end
/*** Do the magic ***/
drop msg.
msg.UMSCODE_MsgText_FILE = args.file
msg.UMSCODE_ToName = "SysOp"
msg.UMSCODE_Subject = "Yeah, Yeah, Yeah"
msg.UMSCODE_ReplyName = "root"
num = UMSWriteMsg(account, msg.)
if num = 0 then do
call CheckErr
end; else do
say "The new message got #" || num
end
/*** Final cleanup ***/
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
SAY "Error: " rc errortext(rc) "Line" sigl
END
/*** Logout ***/
if account ~= 0 then do
call UMSLogout(account)
account = 0
end
exit
/*** Support ***/
CheckErr: procedure expose account
err = UMSErrNum(account)
if err ~= 0 then do
say "UMS Error #" || err || ": " || UMSErrTxt(account)
end
return